package tutorial.hanbo.webservice;

public class GreetingProxy implements tutorial.hanbo.webservice.Greeting {
  private String _endpoint = null;
  private tutorial.hanbo.webservice.Greeting greeting = null;
  
  public GreetingProxy() {
    _initGreetingProxy();
  }
  
  public GreetingProxy(String endpoint) {
    _endpoint = endpoint;
    _initGreetingProxy();
  }
  
  private void _initGreetingProxy() {
    try {
      greeting = (new tutorial.hanbo.webservice.GreetingServiceLocator()).getGreetingPort();
      if (greeting != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)greeting)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)greeting)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (greeting != null)
      ((javax.xml.rpc.Stub)greeting)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public tutorial.hanbo.webservice.Greeting getGreeting() {
    if (greeting == null)
      _initGreetingProxy();
    return greeting;
  }
  
  public java.lang.String greetClient(java.lang.String arg0) throws java.rmi.RemoteException{
    if (greeting == null)
      _initGreetingProxy();
    return greeting.greetClient(arg0);
  }
  
  
}